package lanqiao;

import java.util.Scanner;

public class 数列123 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int i = 0; i < T; i++) {
            int start = scanner.nextInt();
            int end = scanner.nextInt();
            int count = 0;
            int sum = 0;
            for (int j = 1; j <=end ; j++) {
                for (int k = 1; k <=j ; k++) {
                    count++;
                    if (count>=start && count<end){
                        sum+=k;
                    }else if (count==end){
                        System.out.println(sum+k);
                    }
                }
            }

        }
    }
}
